<?php


abstract class BaseShipping extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $id;


	
	protected $status_id;


	
	protected $company_id;


	
	protected $weight_g_from;


	
	protected $weight_g_to;


	
	protected $volume_from;


	
	protected $volume_to;


	
	protected $height_from;


	
	protected $height_to;


	
	protected $width_from;


	
	protected $width_to;


	
	protected $length_from;


	
	protected $length_to;


	
	protected $distance;


	
	protected $european_union;


	
	protected $country_from;


	
	protected $city_from;


	
	protected $country_to;


	
	protected $city_to;


	
	protected $in_same_ciuntry;


	
	protected $time_hours;


	
	protected $price;


	
	protected $currency;


	
	protected $created_at;


	
	protected $valid_til;

	
	protected $collShippingI18ns;

	
	protected $lastShippingI18nCriteria = null;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

  
  protected $culture;

	
	public function getId()
	{

		return $this->id;
	}

	
	public function getStatusId()
	{

		return $this->status_id;
	}

	
	public function getCompanyId()
	{

		return $this->company_id;
	}

	
	public function getWeightGFrom()
	{

		return $this->weight_g_from;
	}

	
	public function getWeightGTo()
	{

		return $this->weight_g_to;
	}

	
	public function getVolumeFrom()
	{

		return $this->volume_from;
	}

	
	public function getVolumeTo()
	{

		return $this->volume_to;
	}

	
	public function getHeightFrom()
	{

		return $this->height_from;
	}

	
	public function getHeightTo()
	{

		return $this->height_to;
	}

	
	public function getWidthFrom()
	{

		return $this->width_from;
	}

	
	public function getWidthTo()
	{

		return $this->width_to;
	}

	
	public function getLengthFrom()
	{

		return $this->length_from;
	}

	
	public function getLengthTo()
	{

		return $this->length_to;
	}

	
	public function getDistance()
	{

		return $this->distance;
	}

	
	public function getEuropeanUnion()
	{

		return $this->european_union;
	}

	
	public function getCountryFrom()
	{

		return $this->country_from;
	}

	
	public function getCityFrom()
	{

		return $this->city_from;
	}

	
	public function getCountryTo()
	{

		return $this->country_to;
	}

	
	public function getCityTo()
	{

		return $this->city_to;
	}

	
	public function getInSameCiuntry()
	{

		return $this->in_same_ciuntry;
	}

	
	public function getTimeHours()
	{

		return $this->time_hours;
	}

	
	public function getPrice()
	{

		return $this->price;
	}

	
	public function getCurrency()
	{

		return $this->currency;
	}

	
	public function getCreatedAt($format = 'Y-m-d H:i:s')
	{

		if ($this->created_at === null || $this->created_at === '') {
			return null;
		} elseif (!is_int($this->created_at)) {
						$ts = strtotime($this->created_at);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true));
			}
		} else {
			$ts = $this->created_at;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getValidTil($format = 'Y-m-d H:i:s')
	{

		if ($this->valid_til === null || $this->valid_til === '') {
			return null;
		} elseif (!is_int($this->valid_til)) {
						$ts = strtotime($this->valid_til);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [valid_til] as date/time value: " . var_export($this->valid_til, true));
			}
		} else {
			$ts = $this->valid_til;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function setId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->id !== $v) {
			$this->id = $v;
			$this->modifiedColumns[] = ShippingPeer::ID;
		}

	} 
	
	public function setStatusId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->status_id !== $v) {
			$this->status_id = $v;
			$this->modifiedColumns[] = ShippingPeer::STATUS_ID;
		}

	} 
	
	public function setCompanyId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->company_id !== $v) {
			$this->company_id = $v;
			$this->modifiedColumns[] = ShippingPeer::COMPANY_ID;
		}

	} 
	
	public function setWeightGFrom($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->weight_g_from !== $v) {
			$this->weight_g_from = $v;
			$this->modifiedColumns[] = ShippingPeer::WEIGHT_G_FROM;
		}

	} 
	
	public function setWeightGTo($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->weight_g_to !== $v) {
			$this->weight_g_to = $v;
			$this->modifiedColumns[] = ShippingPeer::WEIGHT_G_TO;
		}

	} 
	
	public function setVolumeFrom($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->volume_from !== $v) {
			$this->volume_from = $v;
			$this->modifiedColumns[] = ShippingPeer::VOLUME_FROM;
		}

	} 
	
	public function setVolumeTo($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->volume_to !== $v) {
			$this->volume_to = $v;
			$this->modifiedColumns[] = ShippingPeer::VOLUME_TO;
		}

	} 
	
	public function setHeightFrom($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->height_from !== $v) {
			$this->height_from = $v;
			$this->modifiedColumns[] = ShippingPeer::HEIGHT_FROM;
		}

	} 
	
	public function setHeightTo($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->height_to !== $v) {
			$this->height_to = $v;
			$this->modifiedColumns[] = ShippingPeer::HEIGHT_TO;
		}

	} 
	
	public function setWidthFrom($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->width_from !== $v) {
			$this->width_from = $v;
			$this->modifiedColumns[] = ShippingPeer::WIDTH_FROM;
		}

	} 
	
	public function setWidthTo($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->width_to !== $v) {
			$this->width_to = $v;
			$this->modifiedColumns[] = ShippingPeer::WIDTH_TO;
		}

	} 
	
	public function setLengthFrom($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->length_from !== $v) {
			$this->length_from = $v;
			$this->modifiedColumns[] = ShippingPeer::LENGTH_FROM;
		}

	} 
	
	public function setLengthTo($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->length_to !== $v) {
			$this->length_to = $v;
			$this->modifiedColumns[] = ShippingPeer::LENGTH_TO;
		}

	} 
	
	public function setDistance($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->distance !== $v) {
			$this->distance = $v;
			$this->modifiedColumns[] = ShippingPeer::DISTANCE;
		}

	} 
	
	public function setEuropeanUnion($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->european_union !== $v) {
			$this->european_union = $v;
			$this->modifiedColumns[] = ShippingPeer::EUROPEAN_UNION;
		}

	} 
	
	public function setCountryFrom($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->country_from !== $v) {
			$this->country_from = $v;
			$this->modifiedColumns[] = ShippingPeer::COUNTRY_FROM;
		}

	} 
	
	public function setCityFrom($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->city_from !== $v) {
			$this->city_from = $v;
			$this->modifiedColumns[] = ShippingPeer::CITY_FROM;
		}

	} 
	
	public function setCountryTo($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->country_to !== $v) {
			$this->country_to = $v;
			$this->modifiedColumns[] = ShippingPeer::COUNTRY_TO;
		}

	} 
	
	public function setCityTo($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->city_to !== $v) {
			$this->city_to = $v;
			$this->modifiedColumns[] = ShippingPeer::CITY_TO;
		}

	} 
	
	public function setInSameCiuntry($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->in_same_ciuntry !== $v) {
			$this->in_same_ciuntry = $v;
			$this->modifiedColumns[] = ShippingPeer::IN_SAME_CIUNTRY;
		}

	} 
	
	public function setTimeHours($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->time_hours !== $v) {
			$this->time_hours = $v;
			$this->modifiedColumns[] = ShippingPeer::TIME_HOURS;
		}

	} 
	
	public function setPrice($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->price !== $v) {
			$this->price = $v;
			$this->modifiedColumns[] = ShippingPeer::PRICE;
		}

	} 
	
	public function setCurrency($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->currency !== $v) {
			$this->currency = $v;
			$this->modifiedColumns[] = ShippingPeer::CURRENCY;
		}

	} 
	
	public function setCreatedAt($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->created_at !== $ts) {
			$this->created_at = $ts;
			$this->modifiedColumns[] = ShippingPeer::CREATED_AT;
		}

	} 
	
	public function setValidTil($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [valid_til] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->valid_til !== $ts) {
			$this->valid_til = $ts;
			$this->modifiedColumns[] = ShippingPeer::VALID_TIL;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->id = $rs->getInt($startcol + 0);

			$this->status_id = $rs->getInt($startcol + 1);

			$this->company_id = $rs->getInt($startcol + 2);

			$this->weight_g_from = $rs->getInt($startcol + 3);

			$this->weight_g_to = $rs->getInt($startcol + 4);

			$this->volume_from = $rs->getInt($startcol + 5);

			$this->volume_to = $rs->getInt($startcol + 6);

			$this->height_from = $rs->getInt($startcol + 7);

			$this->height_to = $rs->getInt($startcol + 8);

			$this->width_from = $rs->getInt($startcol + 9);

			$this->width_to = $rs->getInt($startcol + 10);

			$this->length_from = $rs->getInt($startcol + 11);

			$this->length_to = $rs->getInt($startcol + 12);

			$this->distance = $rs->getInt($startcol + 13);

			$this->european_union = $rs->getInt($startcol + 14);

			$this->country_from = $rs->getString($startcol + 15);

			$this->city_from = $rs->getString($startcol + 16);

			$this->country_to = $rs->getString($startcol + 17);

			$this->city_to = $rs->getString($startcol + 18);

			$this->in_same_ciuntry = $rs->getInt($startcol + 19);

			$this->time_hours = $rs->getInt($startcol + 20);

			$this->price = $rs->getInt($startcol + 21);

			$this->currency = $rs->getString($startcol + 22);

			$this->created_at = $rs->getTimestamp($startcol + 23, null);

			$this->valid_til = $rs->getTimestamp($startcol + 24, null);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 25; 
		} catch (Exception $e) {
			throw new PropelException("Error populating Shipping object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(ShippingPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			ShippingPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
    if ($this->isNew() && !$this->isColumnModified(ShippingPeer::CREATED_AT))
    {
      $this->setCreatedAt(time());
    }

		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(ShippingPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = ShippingPeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setId($pk);  
					$this->setNew(false);
				} else {
					$affectedRows += ShippingPeer::doUpdate($this, $con);
				}
				$this->resetModified(); 			}

			if ($this->collShippingI18ns !== null) {
				foreach($this->collShippingI18ns as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


			if (($retval = ShippingPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}


				if ($this->collShippingI18ns !== null) {
					foreach($this->collShippingI18ns as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}


			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = ShippingPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getId();
				break;
			case 1:
				return $this->getStatusId();
				break;
			case 2:
				return $this->getCompanyId();
				break;
			case 3:
				return $this->getWeightGFrom();
				break;
			case 4:
				return $this->getWeightGTo();
				break;
			case 5:
				return $this->getVolumeFrom();
				break;
			case 6:
				return $this->getVolumeTo();
				break;
			case 7:
				return $this->getHeightFrom();
				break;
			case 8:
				return $this->getHeightTo();
				break;
			case 9:
				return $this->getWidthFrom();
				break;
			case 10:
				return $this->getWidthTo();
				break;
			case 11:
				return $this->getLengthFrom();
				break;
			case 12:
				return $this->getLengthTo();
				break;
			case 13:
				return $this->getDistance();
				break;
			case 14:
				return $this->getEuropeanUnion();
				break;
			case 15:
				return $this->getCountryFrom();
				break;
			case 16:
				return $this->getCityFrom();
				break;
			case 17:
				return $this->getCountryTo();
				break;
			case 18:
				return $this->getCityTo();
				break;
			case 19:
				return $this->getInSameCiuntry();
				break;
			case 20:
				return $this->getTimeHours();
				break;
			case 21:
				return $this->getPrice();
				break;
			case 22:
				return $this->getCurrency();
				break;
			case 23:
				return $this->getCreatedAt();
				break;
			case 24:
				return $this->getValidTil();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = ShippingPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getId(),
			$keys[1] => $this->getStatusId(),
			$keys[2] => $this->getCompanyId(),
			$keys[3] => $this->getWeightGFrom(),
			$keys[4] => $this->getWeightGTo(),
			$keys[5] => $this->getVolumeFrom(),
			$keys[6] => $this->getVolumeTo(),
			$keys[7] => $this->getHeightFrom(),
			$keys[8] => $this->getHeightTo(),
			$keys[9] => $this->getWidthFrom(),
			$keys[10] => $this->getWidthTo(),
			$keys[11] => $this->getLengthFrom(),
			$keys[12] => $this->getLengthTo(),
			$keys[13] => $this->getDistance(),
			$keys[14] => $this->getEuropeanUnion(),
			$keys[15] => $this->getCountryFrom(),
			$keys[16] => $this->getCityFrom(),
			$keys[17] => $this->getCountryTo(),
			$keys[18] => $this->getCityTo(),
			$keys[19] => $this->getInSameCiuntry(),
			$keys[20] => $this->getTimeHours(),
			$keys[21] => $this->getPrice(),
			$keys[22] => $this->getCurrency(),
			$keys[23] => $this->getCreatedAt(),
			$keys[24] => $this->getValidTil(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = ShippingPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setId($value);
				break;
			case 1:
				$this->setStatusId($value);
				break;
			case 2:
				$this->setCompanyId($value);
				break;
			case 3:
				$this->setWeightGFrom($value);
				break;
			case 4:
				$this->setWeightGTo($value);
				break;
			case 5:
				$this->setVolumeFrom($value);
				break;
			case 6:
				$this->setVolumeTo($value);
				break;
			case 7:
				$this->setHeightFrom($value);
				break;
			case 8:
				$this->setHeightTo($value);
				break;
			case 9:
				$this->setWidthFrom($value);
				break;
			case 10:
				$this->setWidthTo($value);
				break;
			case 11:
				$this->setLengthFrom($value);
				break;
			case 12:
				$this->setLengthTo($value);
				break;
			case 13:
				$this->setDistance($value);
				break;
			case 14:
				$this->setEuropeanUnion($value);
				break;
			case 15:
				$this->setCountryFrom($value);
				break;
			case 16:
				$this->setCityFrom($value);
				break;
			case 17:
				$this->setCountryTo($value);
				break;
			case 18:
				$this->setCityTo($value);
				break;
			case 19:
				$this->setInSameCiuntry($value);
				break;
			case 20:
				$this->setTimeHours($value);
				break;
			case 21:
				$this->setPrice($value);
				break;
			case 22:
				$this->setCurrency($value);
				break;
			case 23:
				$this->setCreatedAt($value);
				break;
			case 24:
				$this->setValidTil($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = ShippingPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setStatusId($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setCompanyId($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setWeightGFrom($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setWeightGTo($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setVolumeFrom($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setVolumeTo($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setHeightFrom($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setHeightTo($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setWidthFrom($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setWidthTo($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setLengthFrom($arr[$keys[11]]);
		if (array_key_exists($keys[12], $arr)) $this->setLengthTo($arr[$keys[12]]);
		if (array_key_exists($keys[13], $arr)) $this->setDistance($arr[$keys[13]]);
		if (array_key_exists($keys[14], $arr)) $this->setEuropeanUnion($arr[$keys[14]]);
		if (array_key_exists($keys[15], $arr)) $this->setCountryFrom($arr[$keys[15]]);
		if (array_key_exists($keys[16], $arr)) $this->setCityFrom($arr[$keys[16]]);
		if (array_key_exists($keys[17], $arr)) $this->setCountryTo($arr[$keys[17]]);
		if (array_key_exists($keys[18], $arr)) $this->setCityTo($arr[$keys[18]]);
		if (array_key_exists($keys[19], $arr)) $this->setInSameCiuntry($arr[$keys[19]]);
		if (array_key_exists($keys[20], $arr)) $this->setTimeHours($arr[$keys[20]]);
		if (array_key_exists($keys[21], $arr)) $this->setPrice($arr[$keys[21]]);
		if (array_key_exists($keys[22], $arr)) $this->setCurrency($arr[$keys[22]]);
		if (array_key_exists($keys[23], $arr)) $this->setCreatedAt($arr[$keys[23]]);
		if (array_key_exists($keys[24], $arr)) $this->setValidTil($arr[$keys[24]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(ShippingPeer::DATABASE_NAME);

		if ($this->isColumnModified(ShippingPeer::ID)) $criteria->add(ShippingPeer::ID, $this->id);
		if ($this->isColumnModified(ShippingPeer::STATUS_ID)) $criteria->add(ShippingPeer::STATUS_ID, $this->status_id);
		if ($this->isColumnModified(ShippingPeer::COMPANY_ID)) $criteria->add(ShippingPeer::COMPANY_ID, $this->company_id);
		if ($this->isColumnModified(ShippingPeer::WEIGHT_G_FROM)) $criteria->add(ShippingPeer::WEIGHT_G_FROM, $this->weight_g_from);
		if ($this->isColumnModified(ShippingPeer::WEIGHT_G_TO)) $criteria->add(ShippingPeer::WEIGHT_G_TO, $this->weight_g_to);
		if ($this->isColumnModified(ShippingPeer::VOLUME_FROM)) $criteria->add(ShippingPeer::VOLUME_FROM, $this->volume_from);
		if ($this->isColumnModified(ShippingPeer::VOLUME_TO)) $criteria->add(ShippingPeer::VOLUME_TO, $this->volume_to);
		if ($this->isColumnModified(ShippingPeer::HEIGHT_FROM)) $criteria->add(ShippingPeer::HEIGHT_FROM, $this->height_from);
		if ($this->isColumnModified(ShippingPeer::HEIGHT_TO)) $criteria->add(ShippingPeer::HEIGHT_TO, $this->height_to);
		if ($this->isColumnModified(ShippingPeer::WIDTH_FROM)) $criteria->add(ShippingPeer::WIDTH_FROM, $this->width_from);
		if ($this->isColumnModified(ShippingPeer::WIDTH_TO)) $criteria->add(ShippingPeer::WIDTH_TO, $this->width_to);
		if ($this->isColumnModified(ShippingPeer::LENGTH_FROM)) $criteria->add(ShippingPeer::LENGTH_FROM, $this->length_from);
		if ($this->isColumnModified(ShippingPeer::LENGTH_TO)) $criteria->add(ShippingPeer::LENGTH_TO, $this->length_to);
		if ($this->isColumnModified(ShippingPeer::DISTANCE)) $criteria->add(ShippingPeer::DISTANCE, $this->distance);
		if ($this->isColumnModified(ShippingPeer::EUROPEAN_UNION)) $criteria->add(ShippingPeer::EUROPEAN_UNION, $this->european_union);
		if ($this->isColumnModified(ShippingPeer::COUNTRY_FROM)) $criteria->add(ShippingPeer::COUNTRY_FROM, $this->country_from);
		if ($this->isColumnModified(ShippingPeer::CITY_FROM)) $criteria->add(ShippingPeer::CITY_FROM, $this->city_from);
		if ($this->isColumnModified(ShippingPeer::COUNTRY_TO)) $criteria->add(ShippingPeer::COUNTRY_TO, $this->country_to);
		if ($this->isColumnModified(ShippingPeer::CITY_TO)) $criteria->add(ShippingPeer::CITY_TO, $this->city_to);
		if ($this->isColumnModified(ShippingPeer::IN_SAME_CIUNTRY)) $criteria->add(ShippingPeer::IN_SAME_CIUNTRY, $this->in_same_ciuntry);
		if ($this->isColumnModified(ShippingPeer::TIME_HOURS)) $criteria->add(ShippingPeer::TIME_HOURS, $this->time_hours);
		if ($this->isColumnModified(ShippingPeer::PRICE)) $criteria->add(ShippingPeer::PRICE, $this->price);
		if ($this->isColumnModified(ShippingPeer::CURRENCY)) $criteria->add(ShippingPeer::CURRENCY, $this->currency);
		if ($this->isColumnModified(ShippingPeer::CREATED_AT)) $criteria->add(ShippingPeer::CREATED_AT, $this->created_at);
		if ($this->isColumnModified(ShippingPeer::VALID_TIL)) $criteria->add(ShippingPeer::VALID_TIL, $this->valid_til);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(ShippingPeer::DATABASE_NAME);

		$criteria->add(ShippingPeer::ID, $this->id);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getId();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setId($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setStatusId($this->status_id);

		$copyObj->setCompanyId($this->company_id);

		$copyObj->setWeightGFrom($this->weight_g_from);

		$copyObj->setWeightGTo($this->weight_g_to);

		$copyObj->setVolumeFrom($this->volume_from);

		$copyObj->setVolumeTo($this->volume_to);

		$copyObj->setHeightFrom($this->height_from);

		$copyObj->setHeightTo($this->height_to);

		$copyObj->setWidthFrom($this->width_from);

		$copyObj->setWidthTo($this->width_to);

		$copyObj->setLengthFrom($this->length_from);

		$copyObj->setLengthTo($this->length_to);

		$copyObj->setDistance($this->distance);

		$copyObj->setEuropeanUnion($this->european_union);

		$copyObj->setCountryFrom($this->country_from);

		$copyObj->setCityFrom($this->city_from);

		$copyObj->setCountryTo($this->country_to);

		$copyObj->setCityTo($this->city_to);

		$copyObj->setInSameCiuntry($this->in_same_ciuntry);

		$copyObj->setTimeHours($this->time_hours);

		$copyObj->setPrice($this->price);

		$copyObj->setCurrency($this->currency);

		$copyObj->setCreatedAt($this->created_at);

		$copyObj->setValidTil($this->valid_til);


		if ($deepCopy) {
									$copyObj->setNew(false);

			foreach($this->getShippingI18ns() as $relObj) {
				$copyObj->addShippingI18n($relObj->copy($deepCopy));
			}

		} 

		$copyObj->setNew(true);

		$copyObj->setId(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new ShippingPeer();
		}
		return self::$peer;
	}

	
	public function initShippingI18ns()
	{
		if ($this->collShippingI18ns === null) {
			$this->collShippingI18ns = array();
		}
	}

	
	public function getShippingI18ns($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseShippingI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collShippingI18ns === null) {
			if ($this->isNew()) {
			   $this->collShippingI18ns = array();
			} else {

				$criteria->add(ShippingI18nPeer::ID, $this->getId());

				ShippingI18nPeer::addSelectColumns($criteria);
				$this->collShippingI18ns = ShippingI18nPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(ShippingI18nPeer::ID, $this->getId());

				ShippingI18nPeer::addSelectColumns($criteria);
				if (!isset($this->lastShippingI18nCriteria) || !$this->lastShippingI18nCriteria->equals($criteria)) {
					$this->collShippingI18ns = ShippingI18nPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastShippingI18nCriteria = $criteria;
		return $this->collShippingI18ns;
	}

	
	public function countShippingI18ns($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BaseShippingI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(ShippingI18nPeer::ID, $this->getId());

		return ShippingI18nPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addShippingI18n(ShippingI18n $l)
	{
		$this->collShippingI18ns[] = $l;
		$l->setShipping($this);
	}

  public function getCulture()
  {
    return $this->culture;
  }

  public function setCulture($culture)
  {
    $this->culture = $culture;
  }

  public function getName()
  {
    $obj = $this->getCurrentShippingI18n();

    return ($obj ? $obj->getName() : null);
  }

  public function setName($value)
  {
    $this->getCurrentShippingI18n()->setName($value);
  }

  public function getText()
  {
    $obj = $this->getCurrentShippingI18n();

    return ($obj ? $obj->getText() : null);
  }

  public function setText($value)
  {
    $this->getCurrentShippingI18n()->setText($value);
  }

  protected $current_i18n = array();

  public function getCurrentShippingI18n()
  {
    if (!isset($this->current_i18n[$this->culture]))
    {
      $obj = ShippingI18nPeer::retrieveByPK($this->getId(), $this->culture);
      if ($obj)
      {
        $this->setShippingI18nForCulture($obj, $this->culture);
      }
      else
      {
        $this->setShippingI18nForCulture(new ShippingI18n(), $this->culture);
        $this->current_i18n[$this->culture]->setCulture($this->culture);
      }
    }

    return $this->current_i18n[$this->culture];
  }

  public function setShippingI18nForCulture($object, $culture)
  {
    $this->current_i18n[$culture] = $object;
    $this->addShippingI18n($object);
  }

} 